package com.wjw.java.juc;

import lombok.extern.slf4j.Slf4j;

/**
 * 线程交替执行案例:t1线程、t2线程、主线程交替执行
 * -------------------------------------------------------------------
 * windows在cmd窗口中如何查看进程PID
 * -------------------------------------------------------------------
 * tastlist                     查看所有线程
 * tasklist | findstr java      查看java进程
 * jps                          查看java进程,可以看到进程的具体类名称
 *
 * -------------------------------------------------------------------
 * windows在cmd窗口中如何杀死进程
 * taskkill /F/PID 28060        强制杀死PID为28060的进程
 * -------------------------------------------------------------------
 * jconsole的使用：查看视频
 * https://www.bilibili.com/video/BV16J411h7Rd?p=19&vd_source=0efc06154070d0db572f3323433991a1
 */
@Slf4j(topic = "c._04ThreadJT")
public class _04ThreadJT {

    public static void main(String[] args) {
        //t1
        new Thread(new Runnable() {
            @Override
            public void run() {
                while(true){
                    log.debug("t1执行...");
                }
            }
        },"t1").start();
        //t2
        new Thread(new Runnable() {
            @Override
            public void run() {
                while(true){
                    log.debug("t2执行...");
                }
            }
        },"t2").start();
        //main
        while (true){
            log.debug("主线程执行...");
        }
    }
}
